import java.util.*;
import java.io.*;

public class Example {
    public static void main(String args[]) {
        File file = new File("Texts/Calem.txt");
        TreeMap<Character, Integer> map = new TreeMap<>();
        try (Scanner in = new Scanner(file)) {
            while (in.hasNext()) {
                String line = in.nextLine();
                for (int i = 0; i <= line.length() - 1; i++) {
                    char ch = line.charAt(i);
                    if (isLetter(ch)) {
                        if (map.containsKey(ch)) {
                            int value = map.get(ch);
                            value++;
                            map.put(ch, value);
                        }
                        else {
                            map.put(ch, 1);
                        }
                    }
                    else continue;
                }
            }
            for (Map.Entry<Character, Integer> entry : map.entrySet()) {
                System.out.println("Number of " + entry.getKey() + "'s: " + entry.getValue());
            }
        }
        catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    private static boolean isLetter(char ch) {
        return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
    }
}
